<?php

declare(strict_types=1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use app\admin\controller\Test as TestController;

class test extends Command
{
    protected function configure()
    {
        // 指令配置
        // 指令配置
        $this->setName('test')
            ->addArgument('name', Argument::OPTIONAL, "your name")
            ->setDescription('the queue command');
    }

    /**
     * 队列switch 需要执行的后续自己添加
     * command示例 : php think queue newPublish
     * @param Input $input
     * @param Output $output
     * @return void
     * 2024-11-14 13 39 42
     * author: jiang
     */
    protected function execute(Input $input, Output $output)
    {
        $name = $input->getArgument('name');
        $handle = new TestController();
        switch ($name) {
            case 'receiveMessage':
                $handle->receiveMessage();
                break;
            case 'receiveDelayMessage':
                $result = $handle->receiveDelayMessage();
                echo $result, "\n";
                break;
            default:
                echo '参数错误 ', "\n";
        }
    }
}
